CREATE OR REPLACE VIEW VPI.VIEW_PROGRESS_LOG AS
SELECT
	L1.LOG_TIME,
	L1.PROGRESS_ID,
	L1.CURRENT_STEP,
	L1.CURRENT_STATUS,
	SUBSTR(L2.LOG_TIME - L1.LOG_TIME, 12)	AS SPENT_TIME
FROM
	VPI.PROGRESS_LOG		L2,
	VPI.PROGRESS_LOG		L1
WHERE
		L2.CURRENT_STEP(+)	= L1.CURRENT_STEP + 1
	AND L2.PROGRESS_ID(+)	= L1.PROGRESS_ID
ORDER BY
	L1.PROGRESS_ID DESC,
	L1.LOG_TIME DESC,
	L1.CURRENT_STEP DESC

WITH READ ONLY;
